package day32;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextInt()) {
            int from_year = scanner.nextInt();
            int from_month = scanner.nextInt();
            int from_day = scanner.nextInt();
            int to_year = scanner.nextInt();
            int to_month = scanner.nextInt();
            int to_day = scanner.nextInt();
            int sum = 0;

            if (from_year == to_year) {//如果是同一年
                System.out.println(getProfit(from_year, from_month, from_day, to_year, to_month, to_day));
                continue;
            }
            // 当 两个是不同年时
            //1、 处理 初始年到年底的利润
            sum += getProfit(from_year, from_month, from_day, from_year, 12, 31);
            //2、终止年 1月1号 到终止日期的利润
            sum += getProfit(to_year, 1, 1, to_year, to_month, to_day);
            //3、之间完整年份的利润
            for (int i = from_year + 1; i < to_year ; i++) {
                sum += getProfit(i, 1, 1, i, 12, 31);
            }
            System.out.println(sum);
        }
    }

    private static boolean isleapyear(int year) {
        if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0)
            return true;
        return false;
    }

    //处理 一年的利润
    private static int getProfit(int from_year, int from_month, int from_day, int to_year, int to_month, int to_day) {
        int[] days = new int[]{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
        int sum = 0;
        if(from_month==to_month) {//如果两个的月份相等 直接就是 日期相减
            if (to_month == 2 || to_month == 3 || to_month == 5 || to_month == 7 || to_month == 11)
                sum = sum + to_day - from_day + 1;
            else
                sum += (to_day - from_day + 1) * 2;
            return sum;
        }
        //对于 from_month 这一月来说 开始的天数可能不是1号
        if (from_month == 2 && isleapyear(from_year)) {
            //如果是闰2月
            sum = sum + 29 - from_day + 1;
        } else if (from_month == 2) {
            sum = sum + 28 - from_day + 1;
        } else if (from_month == 3 || from_month == 5 || from_month == 7 || from_month == 11)
            sum = sum + days[from_month] - from_day + 1;
        else
            sum += (days[from_month] - from_day + 1) * 2;

        //对于 to_month 这一月来说 结束的天数可能不是月底
        if (to_month == 2 || to_month == 3 || to_month == 5 || to_month == 7 || to_month == 11)
            sum = sum + to_day;
        else
            sum += to_day * 2;

        //处理中间完整的月份
        for (int i = from_month + 1; i < to_month ; i++) {
            if (i == 2 && isleapyear(from_year)) {//如果是闰2月
                sum += 29;
            } else if (i == 2) {
                sum = sum + 28;
            } else if (i == 3 || i == 5 || i == 7 || i == 11)
                sum = sum + days[i];
            else
                sum += days[i] * 2;

        }
        return sum;
    }
}